\(\int \cos (c+d x) (a+b \sin (c+d x))^2 (A+B \sin (c+d x)) \, dx\) [1539]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [B] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 29, antiderivative size = 54 \[ \int \cos (c+d x) (a+b \sin (c+d x))^2 (A+B \sin (c+d x)) \, dx=\frac {(A b-a B) (a+b \sin (c+d x))^3}{3 b^2 d}+\frac {B (a+b \sin (c+d x))^4}{4 b^2 d} \]

[Out]

1/3*(A*b-B*a)*(a+b*sin(d*x+c))^3/b^2/d+1/4*B*(a+b*sin(d*x+c))^4/b^2/d

Rubi [A] (verified)

Time = 0.06 (sec) , antiderivative size = 54, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.069, Rules used = {2912, 45} \[ \int \cos (c+d x) (a+b \sin (c+d x))^2 (A+B \sin (c+d x)) \, dx=\frac {(A b-a B) (a+b \sin (c+d x))^3}{3 b^2 d}+\frac {B (a+b \sin (c+d x))^4}{4 b^2 d} \]

[In]

Int[Cos[c + d*x]*(a + b*Sin[c + d*x])^2*(A + B*Sin[c + d*x]),x]

[Out]

((A*b - a*B)*(a + b*Sin[c + d*x])^3)/(3*b^2*d) + (B*(a + b*Sin[c + d*x])^4)/(4*b^2*d)

Rule 45

Int[((a_.) + (b_.)*(x_))^(m_.)*((c_.) + (d_.)*(x_))^(n_.), x_Symbol] :> Int[ExpandIntegrand[(a + b*x)^m*(c + d
*x)^n, x], x] /; FreeQ[{a, b, c, d, n}, x] && NeQ[b*c - a*d, 0] && IGtQ[m, 0] && ( !IntegerQ[n] || (EqQ[c, 0]
&& LeQ[7*m + 4*n + 4, 0]) || LtQ[9*m + 5*(n + 1), 0] || GtQ[m + n + 2, 0])

Rule 2912

Int[cos[(e_.) + (f_.)*(x_)]*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*((c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)
])^(n_.), x_Symbol] :> Dist[1/(b*f), Subst[Int[(a + x)^m*(c + (d/b)*x)^n, x], x, b*Sin[e + f*x]], x] /; FreeQ[
{a, b, c, d, e, f, m, n}, x]

Rubi steps \begin{align*} \text {integral}& = \frac {\text {Subst}\left (\int (a+x)^2 \left (A+\frac {B x}{b}\right ) \, dx,x,b \sin (c+d x)\right )}{b d} \\ & = \frac {\text {Subst}\left (\int \left (\frac {(A b-a B) (a+x)^2}{b}+\frac {B (a+x)^3}{b}\right ) \, dx,x,b \sin (c+d x)\right )}{b d} \\ & = \frac {(A b-a B) (a+b \sin (c+d x))^3}{3 b^2 d}+\frac {B (a+b \sin (c+d x))^4}{4 b^2 d} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.05 (sec) , antiderivative size = 41, normalized size of antiderivative = 0.76 \[ \int \cos (c+d x) (a+b \sin (c+d x))^2 (A+B \sin (c+d x)) \, dx=\frac {(a+b \sin (c+d x))^3 (4 A b-a B+3 b B \sin (c+d x))}{12 b^2 d} \]

[In]

Integrate[Cos[c + d*x]*(a + b*Sin[c + d*x])^2*(A + B*Sin[c + d*x]),x]

[Out]

((a + b*Sin[c + d*x])^3*(4*A*b - a*B + 3*b*B*Sin[c + d*x]))/(12*b^2*d)

Maple [A] (verified)

Time = 0.48 (sec) , antiderivative size = 73, normalized size of antiderivative = 1.35

method result size
derivativedivides \(\frac {\frac {B \left (\sin ^{4}\left (d x +c \right )\right ) b^{2}}{4}+\frac {\left (A \,b^{2}+2 B a b \right ) \left (\sin ^{3}\left (d x +c \right )\right )}{3}+\frac {\left (2 A a b +B \,a^{2}\right ) \left (\sin ^{2}\left (d x +c \right )\right )}{2}+A \sin \left (d x +c \right ) a^{2}}{d}\) \(73\)
default \(\frac {\frac {B \left (\sin ^{4}\left (d x +c \right )\right ) b^{2}}{4}+\frac {\left (A \,b^{2}+2 B a b \right ) \left (\sin ^{3}\left (d x +c \right )\right )}{3}+\frac {\left (2 A a b +B \,a^{2}\right ) \left (\sin ^{2}\left (d x +c \right )\right )}{2}+A \sin \left (d x +c \right ) a^{2}}{d}\) \(73\)
parallelrisch \(\frac {\left (-48 A a b -24 B \,a^{2}-12 B \,b^{2}\right ) \cos \left (2 d x +2 c \right )+\left (-8 A \,b^{2}-16 B a b \right ) \sin \left (3 d x +3 c \right )+3 B \cos \left (4 d x +4 c \right ) b^{2}+\left (96 A \,a^{2}+24 A \,b^{2}+48 B a b \right ) \sin \left (d x +c \right )+48 A a b +24 B \,a^{2}+9 B \,b^{2}}{96 d}\) \(114\)
risch \(\frac {\sin \left (d x +c \right ) A \,a^{2}}{d}+\frac {\sin \left (d x +c \right ) A \,b^{2}}{4 d}+\frac {\sin \left (d x +c \right ) B a b}{2 d}+\frac {\cos \left (4 d x +4 c \right ) B \,b^{2}}{32 d}-\frac {\sin \left (3 d x +3 c \right ) A \,b^{2}}{12 d}-\frac {\sin \left (3 d x +3 c \right ) B a b}{6 d}-\frac {\cos \left (2 d x +2 c \right ) A a b}{2 d}-\frac {\cos \left (2 d x +2 c \right ) B \,a^{2}}{4 d}-\frac {\cos \left (2 d x +2 c \right ) B \,b^{2}}{8 d}\) \(151\)
norman \(\frac {\frac {2 \left (9 A \,a^{2}+4 A \,b^{2}+8 B a b \right ) \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{3 d}+\frac {2 \left (9 A \,a^{2}+4 A \,b^{2}+8 B a b \right ) \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{3 d}+\frac {2 \left (2 A a b +B \,a^{2}\right ) \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}+\frac {2 \left (2 A a b +B \,a^{2}\right ) \left (\tan ^{6}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}+\frac {2 \left (4 A a b +2 B \,a^{2}+2 B \,b^{2}\right ) \left (\tan ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}+\frac {2 A \,a^{2} \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d}+\frac {2 A \,a^{2} \left (\tan ^{7}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}}{\left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )^{4}}\) \(212\)

[In]

int(cos(d*x+c)*(a+b*sin(d*x+c))^2*(A+B*sin(d*x+c)),x,method=_RETURNVERBOSE)

[Out]

1/d*(1/4*B*sin(d*x+c)^4*b^2+1/3*(A*b^2+2*B*a*b)*sin(d*x+c)^3+1/2*(2*A*a*b+B*a^2)*sin(d*x+c)^2+A*sin(d*x+c)*a^2
)

Fricas [A] (verification not implemented)

none

Time = 0.28 (sec) , antiderivative size = 92, normalized size of antiderivative = 1.70 \[ \int \cos (c+d x) (a+b \sin (c+d x))^2 (A+B \sin (c+d x)) \, dx=\frac {3 \, B b^{2} \cos \left (d x + c\right )^{4} - 6 \, {\left (B a^{2} + 2 \, A a b + B b^{2}\right )} \cos \left (d x + c\right )^{2} + 4 \, {\left (3 \, A a^{2} + 2 \, B a b + A b^{2} - {\left (2 \, B a b + A b^{2}\right )} \cos \left (d x + c\right )^{2}\right )} \sin \left (d x + c\right )}{12 \, d} \]

[In]

integrate(cos(d*x+c)*(a+b*sin(d*x+c))^2*(A+B*sin(d*x+c)),x, algorithm="fricas")

[Out]

1/12*(3*B*b^2*cos(d*x + c)^4 - 6*(B*a^2 + 2*A*a*b + B*b^2)*cos(d*x + c)^2 + 4*(3*A*a^2 + 2*B*a*b + A*b^2 - (2*
B*a*b + A*b^2)*cos(d*x + c)^2)*sin(d*x + c))/d

Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 117 vs. \(2 (46) = 92\).

Time = 0.17 (sec) , antiderivative size = 117, normalized size of antiderivative = 2.17 \[ \int \cos (c+d x) (a+b \sin (c+d x))^2 (A+B \sin (c+d x)) \, dx=\begin {cases} \frac {A a^{2} \sin {\left (c + d x \right )}}{d} + \frac {A a b \sin ^{2}{\left (c + d x \right )}}{d} + \frac {A b^{2} \sin ^{3}{\left (c + d x \right )}}{3 d} + \frac {B a^{2} \sin ^{2}{\left (c + d x \right )}}{2 d} + \frac {2 B a b \sin ^{3}{\left (c + d x \right )}}{3 d} + \frac {B b^{2} \sin ^{4}{\left (c + d x \right )}}{4 d} & \text {for}\: d \neq 0 \\x \left (A + B \sin {\left (c \right )}\right ) \left (a + b \sin {\left (c \right )}\right )^{2} \cos {\left (c \right )} & \text {otherwise} \end {cases} \]

[In]

integrate(cos(d*x+c)*(a+b*sin(d*x+c))**2*(A+B*sin(d*x+c)),x)

[Out]

Piecewise((A*a**2*sin(c + d*x)/d + A*a*b*sin(c + d*x)**2/d + A*b**2*sin(c + d*x)**3/(3*d) + B*a**2*sin(c + d*x
)**2/(2*d) + 2*B*a*b*sin(c + d*x)**3/(3*d) + B*b**2*sin(c + d*x)**4/(4*d), Ne(d, 0)), (x*(A + B*sin(c))*(a + b
*sin(c))**2*cos(c), True))

Maxima [A] (verification not implemented)

none

Time = 0.27 (sec) , antiderivative size = 74, normalized size of antiderivative = 1.37 \[ \int \cos (c+d x) (a+b \sin (c+d x))^2 (A+B \sin (c+d x)) \, dx=\frac {3 \, B b^{2} \sin \left (d x + c\right )^{4} + 12 \, A a^{2} \sin \left (d x + c\right ) + 4 \, {\left (2 \, B a b + A b^{2}\right )} \sin \left (d x + c\right )^{3} + 6 \, {\left (B a^{2} + 2 \, A a b\right )} \sin \left (d x + c\right )^{2}}{12 \, d} \]

[In]

integrate(cos(d*x+c)*(a+b*sin(d*x+c))^2*(A+B*sin(d*x+c)),x, algorithm="maxima")

[Out]

1/12*(3*B*b^2*sin(d*x + c)^4 + 12*A*a^2*sin(d*x + c) + 4*(2*B*a*b + A*b^2)*sin(d*x + c)^3 + 6*(B*a^2 + 2*A*a*b
)*sin(d*x + c)^2)/d

Giac [A] (verification not implemented)

none

Time = 0.43 (sec) , antiderivative size = 86, normalized size of antiderivative = 1.59 \[ \int \cos (c+d x) (a+b \sin (c+d x))^2 (A+B \sin (c+d x)) \, dx=\frac {3 \, B b^{2} \sin \left (d x + c\right )^{4} + 8 \, B a b \sin \left (d x + c\right )^{3} + 4 \, A b^{2} \sin \left (d x + c\right )^{3} + 6 \, B a^{2} \sin \left (d x + c\right )^{2} + 12 \, A a b \sin \left (d x + c\right )^{2} + 12 \, A a^{2} \sin \left (d x + c\right )}{12 \, d} \]

[In]

integrate(cos(d*x+c)*(a+b*sin(d*x+c))^2*(A+B*sin(d*x+c)),x, algorithm="giac")

[Out]

1/12*(3*B*b^2*sin(d*x + c)^4 + 8*B*a*b*sin(d*x + c)^3 + 4*A*b^2*sin(d*x + c)^3 + 6*B*a^2*sin(d*x + c)^2 + 12*A
*a*b*sin(d*x + c)^2 + 12*A*a^2*sin(d*x + c))/d

Mupad [B] (verification not implemented)

Time = 0.07 (sec) , antiderivative size = 71, normalized size of antiderivative = 1.31 \[ \int \cos (c+d x) (a+b \sin (c+d x))^2 (A+B \sin (c+d x)) \, dx=\frac {{\sin \left (c+d\,x\right )}^2\,\left (\frac {B\,a^2}{2}+A\,b\,a\right )+{\sin \left (c+d\,x\right )}^3\,\left (\frac {A\,b^2}{3}+\frac {2\,B\,a\,b}{3}\right )+\frac {B\,b^2\,{\sin \left (c+d\,x\right )}^4}{4}+A\,a^2\,\sin \left (c+d\,x\right )}{d} \]

[In]

int(cos(c + d*x)*(A + B*sin(c + d*x))*(a + b*sin(c + d*x))^2,x)

[Out]

(sin(c + d*x)^2*((B*a^2)/2 + A*a*b) + sin(c + d*x)^3*((A*b^2)/3 + (2*B*a*b)/3) + (B*b^2*sin(c + d*x)^4)/4 + A*
a^2*sin(c + d*x))/d